package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.xs.XsOrderSource;
import com.ruoyi.system.mapper.XsOrderSourceMapper;
import com.ruoyi.system.service.IXsOrderSourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订单来源Service业务层处理
 *
 * @author ruoyi
 * @date 2025-01-13
 */
@Service
public class XsOrderSourceServiceImpl extends ServiceImpl<XsOrderSourceMapper, XsOrderSource>
        implements IXsOrderSourceService {
    @Autowired
    private XsOrderSourceMapper xsOrderSourceMapper;

    /**
     * 查询订单来源
     *
     * @param id 订单来源主键
     * @return 订单来源
     */
    @Override
    public XsOrderSource selectXsOrderSourceById(Long id) {
        return xsOrderSourceMapper.selectXsOrderSourceById(id);
    }

    /**
     * 查询订单来源列表
     *
     * @param xsOrderSource 订单来源
     * @return 订单来源
     */
    @Override
    public List<XsOrderSource> selectXsOrderSourceList(XsOrderSource xsOrderSource) {
        return xsOrderSourceMapper.selectXsOrderSourceList(xsOrderSource);
    }

    /**
     * 新增订单来源
     *
     * @param xsOrderSource 订单来源
     * @return 结果
     */
    @Override
    public int insertXsOrderSource(XsOrderSource xsOrderSource) {
        xsOrderSource.setCreateTime(DateUtils.getNowDate());
        return xsOrderSourceMapper.insertXsOrderSource(xsOrderSource);
    }

    /**
     * 修改订单来源
     *
     * @param xsOrderSource 订单来源
     * @return 结果
     */
    @Override
    public int updateXsOrderSource(XsOrderSource xsOrderSource) {
        xsOrderSource.setUpdateTime(DateUtils.getNowDate());
        return xsOrderSourceMapper.updateXsOrderSource(xsOrderSource);
    }

    /**
     * 批量删除订单来源
     *
     * @param ids 需要删除的订单来源主键
     * @return 结果
     */
    @Override
    public int deleteXsOrderSourceByIds(Long[] ids) {
        return xsOrderSourceMapper.deleteXsOrderSourceByIds(ids);
    }

    /**
     * 删除订单来源信息
     *
     * @param id 订单来源主键
     * @return 结果
     */
    @Override
    public int deleteXsOrderSourceById(Long id) {
        return xsOrderSourceMapper.deleteXsOrderSourceById(id);
    }
}
